/*
 * =====================================================================================
 *
 *       Filename:  Handler.cc
 *
 *    Description:
 *
 *        Version:  1.0
 *        Created:  01/05/2022 08:19:22 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  first_name last_name (fl), fl@my-company.com
 *        Company:  my-company
 *
 * =====================================================================================
 */

#include "Handler.h"
#include <iostream>
using std::cout;
using std::endl;
CHandler::CHandler(int _level): m_level(_level) {
    m_pNextHandler = NULL;
}

CHandler::~CHandler(void) {
}

void CHandler::HandleMessage(IWomen* pwomen) {
    if (pwomen->GetType() == this->m_level) {
        this->Response(pwomen);
    } else {
        if (this->m_pNextHandler != NULL) {
            this->m_pNextHandler->HandleMessage(pwomen);
        } else {
            cout << "----------没地方请示了，不做处理！----------" << endl;
        }
    }
}

void CHandler::SetNext(CHandler* phandler) {
    m_pNextHandler = phandler;
}
